
    <html>  
    <head>  
        <meta charset="utf-8">  
        <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">  
        <title>办事指南列表</title>  
	    <link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" href="../../css/app.css">
        <style type="text/css">  
            html,body {
				background-color: #EFEFF4!important;
				-webkit-overflow-scrolling:touch;
			}
			.mui-bar~.mui-content .mui-fullscreen {
				top: 45px;
				height: auto;
			}
			.mui-pull-top-tips {
				position: absolute;
				top: -20px;
				left: 50%;
				margin-left: -25px;
				width: .9rem;
				height:.9rem;
				border-radius: 100%;
				z-index: 1;
			}
			.mui-bar~.mui-pull-top-tips {
				top: 24px;
			}
			.mui-pull-top-wrapper {
				width:.9rem;
				height: .9rem;
				display: block;
				text-align: center;
				background-color: #efeff4;
				border: 1px solid #ddd;
				border-radius: 25px;
				background-clip: padding-box;
				box-shadow: 0 4px 10px #bbb;
				overflow: hidden;
			}
			.mui-pull-top-tips.mui-transitioning {
				-webkit-transition-duration: 200ms;
				transition-duration: 200ms;
			}
			.mui-pull-top-tips .mui-pull-loading {
				
				margin: 0;
			}
			.mui-pull-top-wrapper .mui-icon.mui-reverse {
				/*-webkit-transform: rotate(180deg) translateZ(0);*/
			}
			.mui-pull-bottom-tips {
				text-align: center;
				background-color: #efeff4;
				font-size: 15px;
				line-height:.9rem;
				color: #777;
			}
			.mui-pull-top-canvas {
				overflow: hidden;
				background-color: #fafafa;
				border-radius: 40px;
				box-shadow: 0 4px 10px #bbb;
				width: .9rem;
				height: .9rem;
				margin: 0 auto;
			}
			.mui-pull-top-canvas canvas {
				width:.9rem;
			}
			.mui-slider-indicator.mui-segmented-control {
				background-color: #efeff4;
			}
			/*头部*/
			.mui-bar-nav{z-index:30;}
			.mui-title .arr{width:.12rem;height:.12rem;display:block;background:url(../../images/work/arrow_gray01.png) no-repeat;background-size:100% auto;position:absolute;bottom:16px;right:1.8rem;}
			/*菜单*/
			.mui-bar-nav~.mui-content{padding:0;position:absolute;left:0;top:44px;}
			.mui-segmented-control{background:#fff;border:none;/*border-bottom:1px solid #e1e0e0;*/}
			.mui-segmented-control.mui-scroll-wrapper .mui-scroll,.mui-segmented-control.mui-scroll-wrapper{height:.95rem;}
			.mui-segmented-control .mui-control-item{float:left;overflow:inherit;width:2.4rem;border-right:1px solid #EFEFF4;height:.95rem;line-height:.95rem;font-size:.32rem;color:#444;position:relative;padding:0;
			border-left:0;}
			.mui-segmented-control .mui-control-item:last-child{border-right:none;}
			.mui-control-item>.arrow{width:.12rem;height:.12rem;display:block;background:url(../../images/work/arrow_gray.png) no-repeat;position:absolute;bottom:.35rem;right:.16rem;background-size:100% auto;}
			/*.mui-control-item.mui-active>.arrow{background:url(../../images/work/arrow_blue.png) no-repeat;background-size:100% auto;}*/
			.mui-segmented-control .mui-control-item.mui-active{color:#444;background:#fff;}
			.mui-control-item>.choose{width:.28rem;height:.33rem;display:block;background:url(../../images/work/icon-sxss-@2x.png) no-repeat;background-size:100% 100%;position:absolute;bottom:.31rem;right:.25rem;}
			/*.mui-control-item.mui-active>.choose{background:url(../../images/work/icon-sxss-@2x01.png) no-repeat;background-size:100% 100%;}*/
			/*.mui-segmented-control.mui-segmented-control-inverted .mui-control-item.mui-active .suggest_box{display:block;}			*/
			/*办事列表*/
			.mui-table-view{width:100%;float:left;padding:0;margin:0;background:transparent;}
			.mui-table-view>dd{width:7.5rem;overflow:hidden;padding:.35rem .25rem;/*margin:0 0 .2rem 0;*/margin:0;/*border-bottom: 0.01rem solid #EEEEEE;*/background:#fff;box-sizing:border-box;position: relative;}
			.mui-table-view>dd:after{position: absolute;right: 0;left: 0;top:0;height: 1px;content: '';-webkit-transform: scaleY(.1);transform: scaleY(.1);background-color: #333;}
			.mui-table-view>dd .title_top{width:100%;float:left;}
			.title_top .title_top_text{width:6.45rem;float:left;overflow:hidden;white-space:nowrap;display:block;text-overflow:ellipsis;font-size:.305rem;color:#333;font-weight: 500;}
			.title_top .mui-icon-arrowdown{float:right;margin-top:0.02rem;font-size:.4rem;width:.5rem;height:.4rem;text-align:right;}
			.title_bottom{display:none;width:100%;background:#f3f3f3;border-radius:.08rem;margin-top:.2rem;padding:.2rem .25rem;box-sizing:border-box;float:left;}
			.title_bottom>a{width:100%;color:#333;font-size:.3rem;display:block;padding:.1rem 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
			.title_bottom>a>i{display:block;width:.15rem;height:.15rem;background:url(../../images/work/fab.png) no-repeat;background-size:100% auto;float:left;margin:.17rem .1rem 0 0;}
			.banshi_active .mui-icon-arrowdown{/*color:#4072fd;*/margin-top:-.02rem;}
			.banshi_active .mui-icon-arrowdown:before{content:'\e580';}
			.mui-sliders{position:absolute;height:100%;width:100%;overflow:hidden;z-index:1;}
			.mui-sliders .mui-slider-groups{position: absolute; top:.97rem;bottom: 0;width: 100%;height: auto;/*background:#fff;*/}
		    .mui-sliders .mui-slider-groups .mui-slider-item {position: relative;display: inline-block;width: 100%;
    	    height:100%;vertical-align: top; white-space: normal;}
            /*.mui-table-view>.banshi_active{padding-top:.18rem;}*/
           /*特定对象菜单*/
          .suggest_box04{top:0;position:fixed;z-index:5;}
          .more_cont{width:6.42rem;z-index:13;background:#fff;float:left;}
          .more_cont>h5{line-height:.38rem;font-size:.24rem;color:#999;width:100%;margin:.2rem 0 0 0;padding-left:.3rem;box-sizing:border-box;float:left;}
          .more_cont>h5>img{width:.3rem;height:.3rem;float:left;margin:.014rem .1rem 0 0;}
          .more_cont>h5>span{float:left;}
          .more_cont>.moreCont_list{width:100%;float:left;padding:0 .16rem;box-sizing:border-box;margin-top: -5px;}
          .more_cont>.moreCont_list>a{display:block;width:1.73rem;float:left;background:#eee;border-radius:.04rem;height:.62rem;line-height:.68rem;font-size:.26rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
          text-align:center;margin:.3rem .15rem 0 .15rem;color:#333;position:relative;}
          .more_cont>.moreCont_list .moreActive{color:#0078cb;background:url(../../images/work/cuowu.png) no-repeat;background-size:100% 100%;}
          .btnBox{position:fixed;bottom:0;width:100%;z-index:100000;}
          .btnBox>a{display:block;height:.8rem;line-height:.8rem;text-align:center;color:#fff;font-size:.28rem;float:left;}
          .btnBox>.cancel{width:2.7rem;background:#6eafdd;}
          .btnBox>.queding{width:3.72rem;background:#104ffc;}
          .mui-off-canvas-left, .mui-off-canvas-right{width:6.42rem;}
          .mui-scroll-wrapper{z-index:600;overflow:auto;}
          .item_text{max-width:1.8rem;white-space:nowrap;overflow:hidden;display:block;margin:0 auto;}
          .conts{overflow:auto;}
          .mui-table-view:after{content: none;}
          .mui-scrollbar{z-index:100;}
        </style>  
    </head>  
    <body>  
	<!--侧滑菜单容器  mui-slide-in-->
		<div id="offCanvasWrapper" class="mui-off-canvas-wrap mui-draggable mui-slide-in">
			<!--菜单部分-->
			<aside id="offCanvasSide" class="mui-off-canvas-right">
				<div id="offCanvasSideScroll" class="mui-scroll-wrapper">
					<div class="conts">
				    <div class="more_cont">
						<h5><img src="../../images/work/fwdx-@2x.png"><span>服务主题</span></h5>
						<div class="moreCont_list" id="fwztDiv">
						</div>
						<h5><img src="../../images/work/smzq-@2x.png"><span>特定对象</span></h5>
						<div class="moreCont_list"  id="tddxDiv">
						</div>
						<!--<h5><img src="../../images/work/sxgz-@2x.png"><span>生命周期</span></h5>
						<div class="moreCont_list" id="smzqDiv">
						</div>-->
						<h5><img src="../../images/work/smzq-@2x.png"><span>事项类型</span></h5>
						<div class="moreCont_list" id="sxlxDiv">
						</div>
						<h5><img src="../../images/work/sxgz-@2x.png"><span>办理形式</span></h5>
						<div class="moreCont_list" id="blxsDiv">
						</div>
						<h5><img src="../../images/work/sxgz-@2x.png"><span>行政管辖</span></h5>
						<div class="moreCont_list" id="xzgxDiv">
						</div>
						<div style="float:left;height:1rem;width:100%;"></div>
					</div>
					</div>
				    <!--按钮-->
				    <div class="btnBox">
					    	<a class="cancel" id="cancelQuery">重置</a>
					    	<a class="queding" id="subminQuery">确定</a>
				    </div>
				</div>
			</aside>
			<!--内容部分-->
			<div class="mui-inner-wrap">
				<!--主内容-->
				<div id="offCanvasContentScroll" class="mui-content mui-scroll-wrapper">
					<div class="mui-sliders">
						<!--菜单-->
						<div id="segmentedControl" class="mui-segmented-control">
							<a class="mui-control-item mui-control-item01">
								<span class="item_text" id="address">全部地区</span>
								<i class="arrow"></i>
							</a>
							<a class="mui-control-item mui-control-item02">
								<span class="item_text" id="organ">全部部门</span> 
								<i class="arrow"></i>
							</a>
							<a class="mui-control-item mui-control-item03" id="offCanvasShow" style="text-align:left;box-sizing:border-box;padding-left:.5rem;">
								<span class="item_text">更多分类</span>
								<i class="choose"></i>
							</a>
						  </div>
						<div class="mui-slider-groups"> 
							<div id="item1" class="mui-control-content mui-active mui-slider-item">
								<div id="scroll" class="mui-scroll-wrapper">
									<div class="mui-scroll" id="muiScrollDiv">
										<dl class="mui-table-view" id="muiScrollDivUl">
										</dl>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<!-- off-canvas backdrop -->
				<div class="mui-off-canvas-backdrop"></div>
			</div>
		</div>
		<script>
			function my_immersed(immersed){
			}
		</script>
		<script src="../../js/immersed.js"></script>
		<script src="../../js/mui.min.js"></script>
		<script src="../../js/jquery2.2.4.min.js"></script>
		<script src="../../js/common.js"></script>
		<script src="../../js/mui.pullToRefresh.js"></script>
		<script src="../../js/mui.pullToRefresh.material.js"></script>
		<script src="../../js/app.js"></script>
		<script>
 			mui.init({
				swipeBack: false
			});
			
			var firstLoadData = false; 
			var pageNum = 0;//刷新并显示第一页
			var pageSize=20;//每页显示数量
			var maxPageNumber = 1;//最大页数
			var userType = "";
			var districtId = "";
			var orgId = "";
			var keyWords = "";
			var sxlx = "";//事项类型
			var blxs = "";//办理形式
			var xzgx = "";//行政管辖
			var fwzt = "";//服务主题
			var smzq = "";//生命周期
			var tddx = "";//特定对象
			var districtName = "";//区划名称
			var orgName = "";//部门名称
			
			mui.plusReady(function() {
				//获取上一个页面传过来的参数开始
				userType = utils.getUrlParam('userType');
				districtId = utils.getUrlParam('districtId');
				districtName = localStorage.getItem('districtName');
				orgId = utils.getUrlParam('orgId');
			    orgName = localStorage.getItem('orgName');
			    
			    document.getElementById("address").innerText = districtName;
				if(orgName != '' && orgName != null){
				    document.getElementById("organ").innerText = orgName;			
				}		
				
				fwzt = utils.getUrlParam('fwzt');
				keyWords = localStorage.getItem('keyWords');
				//获取上一个页面传过来的参数结束
				initDownData();//加载第一页数据
				
				loadQueryCondition(userType);//加载更多分类数据
				
				closeWaitingAndShowView();
				
				//区划选择页面
				var address = document.getElementById("address");
				address.addEventListener('tap',function(event){
					var href = '../work/work_address.html';
					openNewWebview(href);
				});
				
				//部门选择页面
				var organ = document.getElementById("organ");
				organ.addEventListener('tap',function(event){
					utils.showWaiting();
					openNewWin('../work/indexed-bumen.html');
				});
			
			    //选择部门后
				window.addEventListener('updateOrgan',function(event){
					updateSelect(event, 'organ');
					//选择部门后重新刷新页面
					//区划Id
					districtId = document.getElementById('address').getAttribute('addressId');
		            //部门Id 
		            orgId = document.getElementById('organ').getAttribute('organId');
					pageNum = 0;
				    firstLoadData = true;
				    setTimeout(function() {
					    	pullToRefresh.refresh(true);//刷新组件 上拉的操作，如果无更多信息后，调用结束上拉并且传true会禁用上拉。如果需要重新开启上拉，则需要刷新组件。
					    	pullToRefresh.pullUpLoading();
				    }, 500);
				});
			   
			   //选择区划后
			    window.addEventListener('updateDistrict',function(event){
					var id = event.detail.id;
					var name = event.detail.name;
					var district = {"id":id,"name":name};
					localStorage.setItem(SYS_PARAM.KEY_BSZN_DISTRICT, JSON.stringify(district));//保存当前选中区划
					//更新选中区划
					loadDistrict(id, name);
					//重置部门
					var org = document.getElementById('organ');
					org.innerText = '全部部门';
					org.setAttribute('organId','');
					
					//选择区划后重新刷新页面
					//区划Id
					districtId = document.getElementById('address').getAttribute('addressId');
		            //部门Id 
		            orgId = document.getElementById('organ').getAttribute('organId');
					pageNum = 0;
				    firstLoadData = true;
				    setTimeout(function() {
					    	pullToRefresh.refresh(true);//刷新组件 上拉的操作，如果无更多信息后，调用结束上拉并且传true会禁用上拉。如果需要重新开启上拉，则需要刷新组件。
					    	pullToRefresh.pullUpLoading();
				    }, 500);
				
		       });
			   
			  function updateSelect(e,eleId){
				var id = e.detail.id;
				var name = e.detail.name;
				var ele = document.getElementById(eleId);
				ele.innerText = name;
				ele.setAttribute(eleId+'Id', id);
			  }
			  
			});
			
			//打开新页面
			function openNewWebview(href) {
				var w = plus.webview.getWebviewById(href);
				if(plus.webview.getWebviewById(href)){
					w.show('slide-in-right',300);
					return;
				}
				utils.showWaiting();
				openNewWin(href);
			}
			
		   //加载区划
		   function loadDistrict(id, name) {
			   var addr = document.getElementById('address');
			   addr.innerText = name;
			   addr.setAttribute('addressId',id);			   
		   }
			
			var pullToRefresh = null;
			//以下开始为列表js
			(function($) {

				//阻尼系数
				var deceleration = mui.os.ios ? 0.003 : 0.0009;
				$('.mui-scroll-wrapper').scroll({
					bounce: false,
					indicators: true, //是否显示滚动条
					deceleration: deceleration
				});
				$.ready(function() {
					//循环初始化所有下拉刷新，上拉加载。
					$.each(document.querySelectorAll('.mui-scroll'), function(index, pullRefreshEl) {
						pullToRefresh = $(pullRefreshEl).pullToRefresh({
							down: { //下拉刷新
								callback: function() {
									var self = this;
									setTimeout(function() {
										var ul = self.element.querySelector('.mui-table-view');
										pageNum = 1;
										createFragment(index,pageNum,pageSize,function(data) {
											if(null == showFragment(data, true)) {
												ul.innerHTML = '';
												self.endPullDownToRefresh(true);
												self.endPullUpToRefresh(true);//这句主要是用来显示没有更多数据的
											}else {
												self.refresh(true);//这句很关键！有重新触发上拉加载
												ul.innerHTML = '';
												ul.insertBefore(showFragment(data, true), ul.firstChild);
												self.endPullDownToRefresh();
											}
										})
									}, 1000);

								}
							},
							up: { //上拉刷新
								contentrefresh : "正在加载中...",//可选，正在加载状态时，上拉加载控件上显示的标题内容
                      			contentnomore:'没有更多数据了',//可选，请求完
								callback: function() {
									var self = this;
									setTimeout(function() {
										var ul = self.element.querySelector('.mui-table-view');
										pageNum++;//翻下一页
										if(pageNum<=maxPageNumber){
								       		createFragment(index,pageNum,pageSize, function(data) {
								       			//此字段用来判断是否是要重新加载第一页内容   如果为true 表示是  将原来的数据清空
								       			if(firstLoadData){
													ul.innerHTML = ' ';
													firstLoadData = false;
												}
								       			
												if(null == showFragment(data, false)) {
													self.endPullUpToRefresh(true);
												}else {
													ul.appendChild(showFragment(data, false), false);
													if(JSON.parse(data.code) == 0 && JSON.parse(data.result).length < pageSize){
														self.endPullUpToRefresh(true);
													}else{
														self.endPullUpToRefresh();
													}
												}
											})
								        }else{
								        	self.endPullUpToRefresh(true);
								        }
									}, 1000);
								}
							}
						});
					});
				});
			})(mui);
			
			/**
			 * @param {Object} index 
			 * @param {Object} callback 回调函数
			 */
			function createFragment(index, pageNum,pageSize, callback) {
				var param = 'userType=' + userType + '&districtId=' + districtId + '&orgId=' + orgId + '&sxlx=' + sxlx + '&blxs=' + blxs + '&xzgx=' + xzgx + '&fwzt=' + fwzt + '&smzq=' + smzq + '&tddx=' + tddx + '&keyWords=' + keyWords + '&pageSize=' + pageSize+ '&pageNum=' + pageNum;
				//console.log(param);
				var url = 'appHttpService/appBsznServiceList.do';
				utils.ajax(url, function(data) {
					data = JSON.parse(data);
					callback(data);
				}, param);
			};

			/**加载列表
			 * @param {Object} data 数据
			 * @param {Object} reverse  等于true时表示下拉 false表示上拉刷新
			 */
			function showFragment(data, reverse) {
				if(data.code == 0 && data.total>0) {
					maxPageNumber = data.maxPageNumber;
					var temp = JSON.parse(data.result);
						var fragment = document.createDocumentFragment();

						for(var i in temp) {
							var dd = document.createElement('dd');
							var temp_html = "";
							temp_html += "<div class='title_top'>" +
								"<a class='title_top_text'>" + temp[i].directoryName.trim() + "</a>" +
								"<span class='mui-icon mui-icon-arrowdown'></span>" +
								"</div>" 
								//是否存在小项 0是 1否
								if(temp[i].existChildItem == 0){
									if(temp[i].sxDirectoryChildList.length>0){
									  		var sxDirectoryChildHtml="";
											for(var j in temp[i].sxDirectoryChildList){
												sxDirectoryChildHtml +="<a parentExistChildItem="+temp[i].existChildItem+"  id="+temp[i].sxDirectoryChildList[j].oid+"><i></i>" + temp[i].sxDirectoryChildList[j].directoryName + "</a>" ;
											}
											if(sxDirectoryChildHtml != ''){
												temp_html +="<div class='title_bottom'>"+sxDirectoryChildHtml+"</div>";
											}
									 }
								}else if(temp[i].existChildItem == 1){
									if(temp[i].serviceList.length>0){
									 	var serviceListHtml="";
										for(var k in temp[i].serviceList){
											serviceListHtml +="<a parentExistChildItem="+temp[i].existChildItem+" id='"+temp[i].serviceList[k].serviceOid+"'><i></i>" + temp[i].serviceList[k].serviceName+ "</a>" ;
										}
										if(serviceListHtml != ''){
											temp_html +="<div class='title_bottom'>"+serviceListHtml+"</div>";
										}
								  	}
								}
						    dd.innerHTML = temp_html;
							fragment.appendChild(dd);
						}
						return fragment;
				}else{
					return null;
				}
			}
			
			/**
             * 点击大项展示办理项或者小项
             */
			mui("body").on('tap','.title_top',function(){
	            if($(this).parents('dd').hasClass('banshi_active')){
	            	$(this).parents('dd').removeClass('banshi_active');
	            	$('.title_bottom').slideUp(0);
	            }else{
	            	$('.mui-scroll>dl>dd').removeClass('banshi_active');
            	    $(this).parents('dd').addClass('banshi_active');
            	    $('.title_bottom').slideUp(0);
	            	$(this).parents('dd').find('.title_bottom').slideDown(0);
	            }
            })
			/**
             * 查看详情页面
             */
			mui("body").on('tap','.title_bottom a',function(){
	            if(this.getAttribute('parentExistChildItem') == 0){//目录清单详情
	            		utils.showWaiting();
					var directoryOid = this.getAttribute('id');
					localStorage.setItem("directoryOid",directoryOid);
					localStorage.setItem("districtId",districtId);
					localStorage.setItem("userType",userType);
					showTemplates('../work/sxDirectory_detail.html','目录清单详情','../work/sxDirectory_detail.html');
	            }else{//事项清单详情
		            	utils.showWaiting();
		            	var hsw = openNewWin('_www/src/work/bszn_info.html?serviceOid=' + this.getAttribute("id"),{bounce:'none'}, 'bszn_info');
		            	mui.fire(hsw,'getDetail',{serviceOid:this.getAttribute("id")});
	            }
            });
            
            
			//侧滑容器父节点off
			var offCanvasWrapper = mui('#offCanvasWrapper');
			
			//打开侧滑导航
			mui(".mui-segmented-control").on('tap','.mui-control-item03',function(){	
			 	offCanvasWrapper.offCanvas().refresh();
				offCanvasWrapper.offCanvas('show');
			});
			
			//实现ios平台的侧滑关闭页面；
			if (mui.os.plus && mui.os.ios) {
				offCanvasWrapper[0].addEventListener('shown', function(e) { //菜单显示完成事件
					plus.webview.currentWebview().setStyle({
						'popGesture': 'none'
					});
				});
				offCanvasWrapper[0].addEventListener('hidden', function(e) { //菜单关闭完成事件
					plus.webview.currentWebview().setStyle({
						'popGesture': 'close'
					});
				});
			}
		
			
		/**
		 * 重置之后没有点击确定  重新进来之后赋值
		 */
		function resetKey(){
				$("#fwztDiv a").each(function() {//循环每一个a标签
				    if(fwzt == this.getAttribute("id")){
					 	if(!$(this).hasClass('moreActive')){
			         		$(this).addClass('moreActive').siblings().removeClass('moreActive');
			         	}
			         	return false; 
					 }
				});
				
				$("#tddxDiv a").each(function() {//循环每一个a标签
				    if(tddx == this.getAttribute("id")){
					 	if(!$(this).hasClass('moreActive')){
			         		$(this).addClass('moreActive').siblings().removeClass('moreActive');
			         	}
			         	return false;
					 }
				});
				
				$("#smzqDiv a").each(function() {//循环每一个a标签
				    if(smzq == this.getAttribute("id")){
					 	if(!$(this).hasClass('moreActive')){
			         		$(this).addClass('moreActive').siblings().removeClass('moreActive');
			         	}
			         	return false;
					 }
					 
				});
				
				$("#sxlxDiv a").each(function() {//循环每一个a标签
				    if(sxlx == this.getAttribute("id")){
					 	if(!$(this).hasClass('moreActive')){
			         		$(this).addClass('moreActive').siblings().removeClass('moreActive');
			         	}
			         	return false;
					 }
					 
				});
				
				$("#blxsDiv a").each(function() {//循环每一个a标签
				    if(blxs == this.getAttribute("id")){
					 	if(!$(this).hasClass('moreActive')){
			         		$(this).addClass('moreActive').siblings().removeClass('moreActive');
			         	}
			         	return false;
					 }
					 
				});
				
				$("#xzgxDiv a").each(function() {//循环每一个a标签
				    if(xzgx == this.getAttribute("id")){
					 	if(!$(this).hasClass('moreActive')){
			         		$(this).addClass('moreActive').siblings().removeClass('moreActive');
			         	}
			         	return false;
					 }
					 
				});
		}
			

		$('#offCanvasSide').height($(window).height());
		//主界面和侧滑菜单界面均支持区域滚动；
		//mui('#offCanvasSideScroll').scroll();
		mui('#offCanvasContentScroll').scroll();

		//右侧菜单里内容的相关js操作
		$(function(){ 
			 $('.mui-bar-nav~.mui-content').height($(window).height()-45+'px');
			 resetKey();
		});
		
		/**
		 * 初始化上拉刷新
		 */
		function initDownData(){
			if(!pullToRefresh){
				setTimeout(initDownData,200);
			}else{
				pullToRefresh.pullUpLoading();
			}
		}
		
		/**
		 * 加载更多分类
		 * @param {Object} userType 服务对象 个人 或者法人
		 */
		function loadQueryCondition(userType){
			var param = 'userType=' + userType;
				var url = 'appHttpService/appBsznQueryCondition.do';
				utils.ajax(url, function(data) {
					data = JSON.parse(data);
					if(data.code == 0){
						var sxlxData = JSON.parse(data.serviceType);//事项类型
						var blxsData = JSON.parse(data.blxs);//办理形式
						var xzgxData = JSON.parse(data.xzgx);//行政管辖
						var fwztData = JSON.parse(data.fwzt);//服务主题
						/*var smzqData = JSON.parse(data.smzq);//生命周期*/
						var tddxData = JSON.parse(data.bsqt);//特定对象
						
						var sxlxDiv_html="";
						for(var i in sxlxData) {
							sxlxDiv_html+="<a id="+sxlxData[i].serviceTypeOid+">"+sxlxData[i].serviceTypeName+"</a>";
						}
						document.getElementById("sxlxDiv").innerHTML = sxlxDiv_html;
						
						var blxsDiv_html="";
						$.each(blxsData, function(key, value) { 
							blxsDiv_html+="<a id="+key+">"+value+"</a>";
						});
						document.getElementById("blxsDiv").innerHTML = blxsDiv_html;
						
						var xzgxDiv_html="";
						$.each(xzgxData, function(key, value) { 
							xzgxDiv_html+="<a id="+key+">"+value+"</a>";
						});
						document.getElementById("xzgxDiv").innerHTML = xzgxDiv_html;
						
						var fwztDiv_html="";
						for(var i in fwztData) {
							fwztDiv_html+="<a id="+fwztData[i].oid+">"+fwztData[i].name+"</a>";
						}
						document.getElementById("fwztDiv").innerHTML = fwztDiv_html;
						
						/*var smzqDiv_html="";
						for(var i in smzqData) {
							smzqDiv_html+="<a id="+smzqData[i].sysDict.oid+">"+smzqData[i].sysDict.name+"</a>";
						}
						document.getElementById("smzqDiv").innerHTML = smzqDiv_html;*/
						
						var tddxDiv_html="";
						for(var i in tddxData) {
							tddxDiv_html+="<a id="+tddxData[i].oid+">"+tddxData[i].name+"</a>";
						}
						document.getElementById("tddxDiv").innerHTML = tddxDiv_html;
						
						//更多右侧筛选菜单点击
						mui(".moreCont_list").on('tap','a',function(){
				         	if($(this).hasClass('moreActive')){
				         		$(this).removeClass('moreActive');
				         	}else{
				         		$(this).addClass('moreActive').siblings().removeClass('moreActive');
				         	}
				         })
					}
				}, param);
		}
		
		/**
		 * 重置分类查询
		 */
		document.getElementById("cancelQuery").addEventListener('tap',function () {
			$('.more_cont  a').removeClass('moreActive');
		});
		/**
		 * 更多分类确定按钮
		 */
		document.getElementById("subminQuery").addEventListener('tap',function () {
			if($("#sxlxDiv").find('a').hasClass("moreActive")){
			   //包含moreActive class
				sxlx = $("#sxlxDiv").find("[class='moreActive']").attr("id");
			}else{
				sxlx = "";
			}
			
			if($("#blxsDiv").find('a').hasClass("moreActive")){
			   //包含moreActive class
			    blxs = $("#blxsDiv").find("[class='moreActive']").attr("id");
			}else{
				blxs = "";
			}
			
			if($("#xzgxDiv").find('a').hasClass("moreActive")){
			   //包含moreActive class
			    xzgx = $("#xzgxDiv").find("[class='moreActive']").attr("id");
			}else{
				xzgx = "";
			}
			
			if($("#fwztDiv").find('a').hasClass("moreActive")){
			   //包含moreActive class
			    fwzt = $("#fwztDiv").find("[class='moreActive']").attr("id");
			}else{
				fwzt = "";
			}
			
			/*if($("#smzqDiv").find('a').hasClass("moreActive")){
			   //包含moreActive class
			    smzq = $("#smzqDiv").find("[class='moreActive']").attr("id");
			}else{
				smzq = "";
			}*/
			
			if($("#tddxDiv").find('a').hasClass("moreActive")){
			   //包含moreActive class
			    tddx = $("#tddxDiv").find("[class='moreActive']").attr("id");
			}else{
				tddx = "";
			}
			
			//右侧导航栏确定关闭弹出框
		    offCanvasWrapper.offCanvas('close');
		    pageNum = 0;
		    firstLoadData = true;
		    setTimeout(function() {
			    	pullToRefresh.refresh(true);//刷新组件 上拉的操作，如果无更多信息后，调用结束上拉并且传true会禁用上拉。如果需要重新开启上拉，则需要刷新组件。
			    	pullToRefresh.pullDownLoading();
		    }, 500);
		});
        </script>  
    </body>  
 </html>  